<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="templates/common.xhtml">
	<ui:define name="pageTitle">Votre Panier</ui:define>
	<ui:define name="pageHeader">
	</ui:define>

	<ui:define name="body">
		<h:form id="form">

			<p:dataGrid var="UneSelection"
				value="#{basketManagedBean.currentSelections}" columns="1"
				emptyMessage="Pas de sélections">
				<p:growl id="growl" showDetail="true" />
				<p:fieldset legend="#{UneSelection.headername}" toggleable="true"
					toggleSpeed="500" style="h6 small">
					<p:dataGrid var="UneReservation"
						value="#{UneSelection.reservations}" columns="1"
						emptyMessage="Pas de réservations">

						<p:panel header="#{UneReservation.headername}">
							<h:panelGrid columns="2" style="width:90%">
								<h:outputText value="Hotel: #{UneReservation.hotelname} " />
								<p:dataTable var="UneOption"
									value="#{UneReservation.listOptions}"
									emptyMessage="Pas d'options" style="width:200px">
									<f:facet name="header">Options liées à la chambre</f:facet>
									<p:column>
										<f:facet name="header">Nom</f:facet>
										<h:outputText value="#{UneOption.option_name}" />
									</p:column>
									<p:column>
										<f:facet name="header">Prix</f:facet>
										<h:outputText value="#{UneOption.price} euro(s)" />
									</p:column>
									<p:column>
										<f:facet name="header">Quantité</f:facet>
										<h:outputText value="#{UneOption.qte}" />
									</p:column>
									<p:column>
										<p:button disabled="true" icon="ui-icon-circle-close"
											title="Suppression option"></p:button>
									</p:column>
								</p:dataTable>
								<h:outputText
									value="Du #{UneReservation.dateDebut} au #{UneReservation.dateFin}" />
								<h:outputText value=" " />
								<h:outputText
									value="Prix chambre par nuit : #{UneReservation.price} euros" />
								<h:outputText value="Prix total : #{UneReservation.total} euros" />
								<h:outputText value=" " />
							</h:panelGrid>
						</p:panel>
					</p:dataGrid>
				</p:fieldset>
				<p:columnGroup type="footer">
					<p:row>
						<p:column footerText="Montant Total" />
					</p:row>
				</p:columnGroup>
			</p:dataGrid>
			<br />
			<p:panel header="Somme à payer et choix de la devise de paiement">
				<p:outputLabel style="font-size:14px;margin:10px;padding-top:5px;padding-bottom:5px;" for="currenciesComboBox" value="Devise :" />
				<p:selectOneMenu label="toto" id="currenciesComboBox"
					value="#{basketManagedBean.selectedCurrency}">
					<f:selectItems value="#{basketManagedBean.currencies}"
						var="thiscurrency" itemLabel="#{thiscurrency.currencyName}"
						itemValue="#{thiscurrency.currencyName}" />
					<p:ajax listener="#{basketManagedBean.onCurrencySelect}"
						update="ChangeResultField" />
				</p:selectOneMenu>
				<p:outputLabel style="font-size:14px;margin:10px;padding-top:5px;padding-bottom:5px;" for="ChangeResultField" value="Montant à payer :" />
				<p:outputLabel style="font-size:14px;margin:10px;padding-top:5px;padding-bottom:5px;" id="ChangeResultField"
					value="#{basketManagedBean.changeResult}" />
			</p:panel>
			<br />
			<p:commandButton styleClass="btn btn-primary"
				style="font-size:14px;margin:10px;padding-top:5px;padding-bottom:5px;"
				action="#{basketManagedBean.buyBasket}"
				value="#{basketManagedBean.buyStringButton}" />
			<p:commandButton styleClass="btn btn-primary"
				style="font-size:14px;padding-top:5px;padding-bottom:5px;"
				action="#{basketManagedBean.bookBasket}"
				value="Réserver et payer plus tard" />
			<p:commandButton styleClass="btn btn-primary"
				style="font-size:14px;margin:10px;padding-top:5px;padding-bottom:5px;"
				action="#{basketManagedBean.cancelBasket}"
				value="Annuler votre réservation" />
		</h:form>


	</ui:define>

</ui:composition>
</html>